/*
 * heapSort.hpp
 *
 *  Created on: Sep 19, 2011
 *      Author: dgdiniz
 */

#ifndef HEAPSORT_HPP_
#define HEAPSORT_HPP_

#include "data_structures/heap/heapBasics.hpp"

namespace playlib
{

template<typename T>
void heapSort(T list[], const unsigned length)
{
	int end = length-1;

	heapify(list, length);

	while (end > 0)
	{
		swap(list[0], list[end]);
		heapSiftDown(list, 0, --end);
	}
}

}


#endif /* HEAPSORT_HPP_ */
